#include "base/timeevent.h"
#include "base/timeeventset.h"
namespace net_tools::base
{
  Timeeventset::Timeeventset()
      : timeeventset_(){};
  Timeeventset::~Timeeventset(){

  };
  void Timeeventset::Add_timejob(Timeevent *timeevent)
  {
    timeeventset_.insert(timeevent);
  };
  bool Timeeventset::Del_timejob(Timeevent *timeevent)
  {
    if (timeeventset_.erase(timeevent) == 0)
    {
      return false;
    }
    else
    {
      timeevent->func_ = nullptr;
      return true;
    }
  };
  void Timeeventset::Del_all_timejob()
  {
    for (auto iter : timeeventset_)
    {
      iter->func_ = nullptr;
    }
    timeeventset_.clear();
  };

} // namespace net_tools::base